//提取12为无符号数字，对12位无符号数进行符号拓展

module ImmGen(In, immOut);
    input wire[31:0] In;
    output reg[63:0] immOut;
    
    parameter beqOPCode = 7'd5;
    parameter ldOPCode = 7'd6;
    parameter sdOPCode = 7'd7;

    always @(In)
    begin
        case (In[6:0])
            beqOPCode: 
            begin
                immOut[63:12] = 32'b0;
                immOut[11] = In[31];
                immOut[10] = In[7]; 
                immOut[9:4] = In[30:25];
                immOut[3:0] = In[11:8];
            end
            ldOPCode:
            begin
                immOut[11:0] = In[31:20];
                immOut[63:12] = 52'd0;
            end
            sdOPCode:
            begin
                immOut[4:0] = In[11:7];
                immOut[11:5] = In[31:25];
                immOut[63:12] = 52'd0;
            end
        endcase
    end



endmodule